﻿@model CNDreams.Web.Models.ModelTreePageSysUserRightIndex
@{
	ViewBag.Title = "SysUserRightIndex";
    Layout = "~/Views/Shared/_LayoutEmbeddedFrame.cshtml";
}
@*权限管理*@
<style type="text/css">
	#tree
	{
		float: left;
		height: 100%;
		margin: 1px 0 0 0;
		width: 182px;
		background: url("/Content/images/treebg.jpg") no-repeat scroll 0 0 #FFFFFF;
		padding: 10px 0 0 0;
	}
	#content
	{
		float: left;
		height: 100%;
		margin: 1px 0 0 0;
		width: 200px;
		background: url("/Content/images/treebg.jpg") no-repeat scroll 0 0 #FFFFFF;
		border: 1px solid #83AAD3;
		vertical-align: top;
		font-family: "font-family:Verdana, Arial, Helvetica, sans-serif";
		font-size: 12px;
	}
	.user-role-title
	{
		width: 100%;
		font-weight: bold;
		color: Black;
		height: 20px;
		border-bottom: 1px solid #83AAD3;
		padding-top: 6px;
	}
	.user-role-title .user-role-img
	{
		background: url("/Content/images/users.gif") no-repeat;
		padding-left: 20px;
		height: 15px;
	}
	.user-role-toolbar
	{
		border-bottom: 1px solid #83AAD3;
		background: #DFECF9;
		height: 35px;
		padding-top: 10px;
	}
	.user-role-toolbar .lbl-username
	{
		margin-left: 3px;
		float: left;
		padding-top: 7px;
	}
	.user-role-toolbar .username
	{
		width: 73px;
		height: 19px;
		float: left;
	}
	.user-role-toolbar .username-search
	{
		border: 0px;
		background: url("/Content/Images/button/searchbt.gif") no-repeat;
		width: 56px;
		height: 23px;
		margin-left: 5px;
		cursor: pointer;
		float: left;
	}
	.user-role-content
	{
		overflow: auto;
	}
	.node3
	{
		color: #63240E;
	}
</style>
<script type="text/javascript">
    $(function () {
        $("#tree").height($("html").height());
        $(".user-role-content").height($("html").height() - 82);

        /* 初始化树
        ----------------------------------------------------------*/
        var tree = $("#tree").jstree({
            "types": {
                "valid_children": ["root"],
                "types": {
                    "root": {
                        "icon": {
                            "image": "/Content/images/ico0.jpg"
                        },
                        "valid_children": ["default"],
                        "max_depth": 2,
                        "hover_node": false,
                        "select_node": function () { }
                    },
                    "default": {
                        "valid_children": ["default"],
                        "icon": {
                            "image": "/Content/images/ico1.jpg"
                        }
                    },
                    "renter": {
                        "icon": {
                            "image": "/Content/images/ico4.jpg"
                        }
                    },
                    "businessman": {
                        "icon": {
                            "image": "/Content/images/ico4.jpg"
                        }
                    }
                }
            },
            "plugins": ["themes", "html_data", "ui", "types"]
        });
        tree.bind("loaded.jstree", function (event, data) {
            tree.jstree("open_all");
        });

    });

    function setFrameUrl(url) {
        $("#embeddedFrame").attr("src", url);
    }
</script>
@using (Html.BeginForm())
{
	<div id="content">
		<div class="user-role-title">
			<span class="user-role-img">用户角色</span></div>
		<div class="clear">
		</div>
		<div class="user-role-toolbar">
			<label class="lbl-username">
				用户名：</label>
			@Html.TextBoxFor(x => x.UserName, new { maxlength = "9", @class = "username" })<input
				type="submit" value="" class="username-search" />
		</div>
		<div class="clear">
		</div>
        <div class="user-role-content">
			<div id="tree">
				<ul>
                @foreach (var itemOrg in Model.UTOrganizationCollection)
                {
                         <li rel="root"><a>@itemOrg.Name</a>
                   
					
						<ul>
							@foreach (var itemDep in Model.UTOrgDepartmentList.Where(x => x.OrganizationID == itemOrg.ID))
       {
								<li><a>@itemDep.DepartmentName</a>
									@foreach (var itemUser in Model.SysUserList.Where(x => x.DepartmentID == itemDep.ID))
         {
             if (itemUser.DepartmentID == itemDep.ID)
             { 
										<ul>
											<li><a href="javascript:void(0)" onclick="setFrameUrl('/ModuleSys/SysUserRightManage/Index/?id=@itemUser.ID');" style="color:#63240E;">@(itemUser.UserAccount + "[" + itemUser.UserName + "]")</a>
											</li>
										</ul>
             }
         }
								</li>
       }
						</ul>
					</li>
                }
				</ul>
			</div>
		</div>
	</div>
}
